package demo3;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class CardGame {
    public static final String[] suits = {"♦","♣","♠","♥"};
    public List<Card> brand(){
        List<Card> brands = new ArrayList<>();
        for(int i = 0 ; i < 4; i++){
            String suit = suits[i];
            for(int j = 1 ; j < 14; j++){
                Card card = new Card(suit,j);
                brands.add(card);
            }
        }
        return brands;
    }
    public List<Card> shuffle(List<Card> brands){
      Random random = new Random();
      for(int i = brands.size() - 1 ; i > 0;i--){
      int ret = random.nextInt(i);
          swap(brands,i,ret);
      }
      return brands;
    }
    public void swap(List<Card> brands,int i,int ret){
        Card temp = brands.get(i);
        brands.set(i,brands.get(ret));
        brands.set(ret,temp);
        return;
    }
}
